<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="contextPath"
	value="${pageContext.servletContext.contextPath}"></c:set>
<script type="text/javascript">
	function deleteaccount() {
		test.submit();
	}
	function selectAll() {
		var checklist = document.getElementsByName("publisherid");
		if (document.getElementById("publisheridAll").checked) {
			for (var i = 0; i < checklist.length; i++) {
				checklist[i].checked = true;
			}
		} else {
			for (var j = 0; j < checklist.length; j++) {
				checklist[j].checked = false;
			}
		}
	}
</script>


<div class="table-responsive" style="width: 500px;">
	<c:if test="${publisherlist.size() != 0}">
		<form id="test" action="${contextPath}/delpublisher.htm" method="get">
			<table id="mytable" class="table table-hover"
				style="text-align: center">
				<tr>
					<td style="width: 100px;">选择框</td>
					<td style="width: 200px;">出版社名称</td>
					<td style="width: 100px;">操作</td>
				</tr>
				<c:forEach var="item" varStatus="status" items="${publisherlist}">
					<tr>
						<td><input type="checkbox" name="publisherid"
							value="${item.id}" /></td>
						<td>${item.name}</td>
						<td><button type="submit" class="btn btn-success"
								name="oneid" value="${item.id }">删除</button></td>
					</tr>
				</c:forEach>

				<tr>
					<td><input type="checkbox" onclick="selectAll()"
						id="publisheridAll" />全选</td>
					<td>
						<button type="submit" class="btn btn-success">删除选中项</button>
					</td>
				</tr>
			</table>
		</form>
	</c:if>
	<c:if test="${publisherlist.size() == 0}">
		<h2 align="center">没有记录</h2>
	</c:if>
</div>
